﻿#define _CRT_SECURE_NO_WARNINGS 1
#include"SLTNode.h"


void test1()
{
	SLT* node1 = (SLT*)malloc(sizeof(SLT));
	node1->date = 1;

	SLT* node2 = (SLT*)malloc(sizeof(SLT));
	node2->date = 2;

	SLT* node3 = (SLT*)malloc(sizeof(SLT));
	node3->date = 3;

	SLT* node4 = (SLT*)malloc(sizeof(SLT));
	node4->date = 4;

	node1->next = node2;
	node2->next = node3;
	node3->next = node4;
	node4->next = NULL;

	SLT* plist = node1;
	SLTPrint(plist);
}

void test2()
{
	SLT* plist = NULL;
	//尾插
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);
	SListDesTroy(&plist);
	SLTPrint(plist);

	//删除pos
	//SLT* find = SLTFind(plist, 1);
	//SLTErase(&plist, find);
	//SLTPrint(plist);
	//删除pos之后的节点
	/*SLT* find = SLTFind(plist, 1);
	SLTEraseAfter(find);
	SLTPrint(plist);*/

	//头插
	/*SLTPushFront(&plist, 6);
	SLTPrint(plist);
	SLTPushFront(&plist, 7);
	SLTPrint(plist); 
	SLTPushFront(&plist, 8);
	SLTPrint(plist);*/
	//尾删
	/*SLTPopBack(&plist);
	SLTPrint(plist);*/

	//头删
	/*SLTPopFront(&plist);
	SLTPrint(plist);
	SLTPopFront(&plist);
	SLTPrint(plist);
	SLTPopFront(&plist);
	SLTPrint(plist);
	SLTPopFront(&plist);
	SLTPrint(plist);
	SLTPopFront(&plist);
	SLTPrint(plist);*/
	//查找
	/*SLT* find = SLTFind(plist, 11);
	if (find == NULL)
	{
		printf("没有找到！\n");
	}
	else
	{
		printf("找到了！\n");
	}*/

	//在指定位置之前插⼊数据
	/*SLT* find = SLTFind(plist, 3);
	SLTInsert(&plist, find, 11);
	SLTPrint(plist);*/

	//在指定位置之后插⼊数据
	/*SLT* find = SLTFind(plist, 3);
	SLTInsertAfter(find, 11);
	SLTPrint(plist);*/
}
int main()
{
	//test1();

	test2();
	return 0;
}